package com.scarymovieapp.ui;

import java.util.List;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;

import com.scarymovieapp.dao.IscaryMovieDAO;
import com.scarymovieapp.dao.IscaryMovieDAOStub;
import com.scarymovieapp.dto.Movie;
import com.scarymovieapp.dto.MovieSearch;

public class MovieResultsActivity extends ListActivity {

@Override	
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MovieSearch ms = (MovieSearch) this.getIntent().getSerializableExtra(AdvancedMovieSearch.MOVIE_SEARCH);
IscaryMovieDAO movieDAO = new IscaryMovieDAOStub();
//invokes search
List<Movie> results = movieDAO.fetchMovies(ms);

ArrayAdapter<Movie> listAdapter = new ArrayAdapter<Movie>(this, android.R.layout.simple_list_item_1, results);

// show the data.
setListAdapter(listAdapter);

}
}
